

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Libqdma APIs &mdash; QDMA Linux Driver 2018.3 documentation</title>
  

  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  

  
        <link rel="index" title="Index"
              href="genindex.html"/>
        <link rel="search" title="Search" href="search.html"/>
    <link rel="top" title="QDMA Linux Driver 2018.3 documentation" href="index.html"/>
        <link rel="up" title="Developers Guide" href="devguide.html"/>
        <link rel="next" title="QDMA Linux Driver Design Flow" href="qdma_design.html"/>
        <link rel="prev" title="Developers Guide" href="devguide.html"/> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="index.html" class="icon icon-home"> QDMA Linux Driver
          

          
          </a>

          
            
            
              <div class="version">
                2018.3
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
                <p class="caption"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="features.html">QDMA Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="system-requirements.html">System Requirements</a></li>
<li class="toctree-l1"><a class="reference internal" href="build.html">Building and Installing Software Stack</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="devguide.html">Developers Guide</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">Libqdma APIs</a></li>
<li class="toctree-l2"><a class="reference internal" href="qdma_design.html">QDMA Linux Driver Design Flow</a></li>
<li class="toctree-l2"><a class="reference internal" href="qdma_usecases.html">QDMA Linux Driver UseCases</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="userguide.html">User Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="user-app.html">User Applications</a></li>
<li class="toctree-l1"><a class="reference internal" href="performance.html">QDMA Performance</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="index.html">QDMA Linux Driver</a>
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          

 



<div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="index.html">Docs</a> &raquo;</li>
      
          <li><a href="devguide.html">Developers Guide</a> &raquo;</li>
      
    <li>Libqdma APIs</li>
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="_sources/libqdma_apis.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="libqdma-apis">
<h1>Libqdma APIs<a class="headerlink" href="#libqdma-apis" title="Permalink to this headline">¶</a></h1>
<p><strong>Xilinx QDMA Library Interface Definitions</strong></p>
<p>Header file <em>libqdma_export.h</em> defines data structures and function signatures exported by
Xilinx QDMA(libqdma) Library. libqdma is part of Xilinx QDMA Linux Driver.</p>
<dl class="type">
<dt id="c.qdma_error_codes">
enum <code class="descname">qdma_error_codes</code><a class="headerlink" href="#c.qdma_error_codes" title="Permalink to this definition">¶</a></dt>
<dd><p>List of QDMA error codes</p>
</dd></dl>

<p><strong>Constants</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_OPERATION_SUCCESSFUL</span></code></dt>
<dd>QDMA driver API operation successful</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_PCI_DEVICE_NOT_FOUND</span></code></dt>
<dd>QDMA PCI device not found on the PCIe bus</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_PCI_DEVICE_ALREADY_ATTACHED</span></code></dt>
<dd>QDMA PCI device already attached</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_PCI_DEVICE_ENABLE_FAILED</span></code></dt>
<dd>Failed to enable the QDMA PCIe device</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_PCI_DEVICE_INIT_FAILED</span></code></dt>
<dd>Failed to initialize the QDMA PCIe device</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_INVALID_INPUT_PARAM</span></code></dt>
<dd>Invalid input parameter given to QDMA API</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_INVALID_PCI_DEV</span></code></dt>
<dd>Invalid PCIe device</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_INVALID_QIDX</span></code></dt>
<dd>Invalid Queue ID provided as input</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_INVALID_DESCQ_STATE</span></code></dt>
<dd>Invalid descriptor queue state</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_INVALID_DIRECTION</span></code></dt>
<dd>Invalid descriptor direction provided</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_DESCQ_SETUP_FAILED</span></code></dt>
<dd>Failed to setup the descriptor queue</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_DESCQ_FULL</span></code></dt>
<dd>Descriptor queue is full</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_DESCQ_IDX_ALREADY_ADDED</span></code></dt>
<dd>Descriptor queue index is already added</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_QUEUE_ALREADY_CONFIGURED</span></code></dt>
<dd>Queue is already configured</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_OUT_OF_MEMORY</span></code></dt>
<dd>Out of memory</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_INVALID_QDMA_DEVICE</span></code></dt>
<dd>Invalid QDMA device, QDMA device is not yet created</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QDMA_ERR_INTERFACE_NOT_ENABLED_IN_DEVICE</span></code></dt>
<dd>The ST or MM or Both interface not enabled in the device</dd>
</dl>
<p><strong>Description</strong></p>
<p>When libqdma APIs are invoked by application, if any error occured, the corresponding
error code would be returned.</p>
<dl class="type">
<dt id="c.qdma_drv_mode">
enum <code class="descname">qdma_drv_mode</code><a class="headerlink" href="#c.qdma_drv_mode" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether PF/VF qdma driver is loaded in poll or interrupt mode</p>
</dd></dl>

<p><strong>Constants</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">AUTO_MODE</span></code></dt>
<dd>auto mode decided automatically, mix of poll and interrupt mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">POLL_MODE</span></code></dt>
<dd>driver is inserted in poll mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">DIRECT_INTR_MODE</span></code></dt>
<dd>driver is inserted in direct interrupt mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">INDIRECT_INTR_MODE</span></code></dt>
<dd>driver is inserted in indirect interrupt mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">LEGACY_INTR_MODE</span></code></dt>
<dd>driver is inserted in legacy interrupt mode</dd>
</dl>
<p><strong>Description</strong></p>
<p>QDMA PF/VF drivers can be loaded in one of these modes.
Mode options is exposed as a user configurable module parameter</p>
<dl class="type">
<dt id="c.drv_mode_name">
struct <code class="descname">drv_mode_name</code><a class="headerlink" href="#c.drv_mode_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Structure to hold the driver name and mode</p>
</dd></dl>

<p><strong>Definition</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre>struct drv_mode_name {
  enum qdma_drv_mode drv_mode;
  char name;
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">drv_mode</span></code></dt>
<dd>mode of the driver in which it it loaded.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">name</span></code></dt>
<dd>Driver Name</dd>
</dl>
<p><strong>Description</strong></p>
<p>QDMA PF/VF drivers can be loaded in one of these modes.
This structure holds the driver mode and name of the driver</p>
<dl class="function">
<dt id="c.libqdma_init">
int <code class="descname">libqdma_init</code><span class="sig-paren">(</span>enum <a class="reference internal" href="#c.qdma_drv_mode" title="qdma_drv_mode">qdma_drv_mode</a><em>&nbsp;qdma_drv_mode</em>, unsigned int<em>&nbsp;num_threads</em><span class="sig-paren">)</span><a class="headerlink" href="#c.libqdma_init" title="Permalink to this definition">¶</a></dt>
<dd><p>initializes the QDMA core library</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">enum</span> <span class="pre">qdma_drv_mode</span> <span class="pre">qdma_drv_mode</span></code></dt>
<dd>mode in which the driver needs to operate</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">num_threads</span></code></dt>
<dd>number of threads to be created each for request
processing and writeback processing</dd>
</dl>
<p><strong>Return</strong></p>
<p>0:      success &lt;0:     error</p>
<dl class="function">
<dt id="c.libqdma_exit">
void <code class="descname">libqdma_exit</code><span class="sig-paren">(</span>void<span class="sig-paren">)</span><a class="headerlink" href="#c.libqdma_exit" title="Permalink to this definition">¶</a></dt>
<dd><p>cleanup the QDMA core library before exiting</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">void</span></code></dt>
<dd>no arguments</dd>
</dl>
<p><strong>Description</strong></p>
<p>cleanup the QDMA core library before exiting</p>
<dl class="type">
<dt id="c.intr_ring_size_sel">
enum <code class="descname">intr_ring_size_sel</code><a class="headerlink" href="#c.intr_ring_size_sel" title="Permalink to this definition">¶</a></dt>
<dd><p>qdma interrupt ring size selection</p>
</dd></dl>

<p><strong>Constants</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">INTR_RING_SZ_4KB</span></code></dt>
<dd>accommodates 512 entries</dd>
<dt><code class="docutils literal notranslate"><span class="pre">INTR_RING_SZ_8KB</span></code></dt>
<dd>accommodates 1024 entries</dd>
<dt><code class="docutils literal notranslate"><span class="pre">INTR_RING_SZ_12KB</span></code></dt>
<dd>accommodates 1536 entries</dd>
<dt><code class="docutils literal notranslate"><span class="pre">INTR_RING_SZ_16KB</span></code></dt>
<dd>accommodates 2048 entries</dd>
<dt><code class="docutils literal notranslate"><span class="pre">INTR_RING_SZ_20KB</span></code></dt>
<dd>accommodates 2560 entries</dd>
<dt><code class="docutils literal notranslate"><span class="pre">INTR_RING_SZ_24KB</span></code></dt>
<dd>accommodates 3072 entries</dd>
<dt><code class="docutils literal notranslate"><span class="pre">INTR_RING_SZ_28KB</span></code></dt>
<dd>accommodates 3584 entries</dd>
<dt><code class="docutils literal notranslate"><span class="pre">INTR_RING_SZ_32KB</span></code></dt>
<dd>accommodates 4096 entries</dd>
</dl>
<p><strong>Description</strong></p>
<p>Each interrupt vector can be associated with 1 or more interrupt rings.
The software can choose 8 different interrupt ring sizes. The ring size for each vector
is programmed during interrupt context programming</p>
<dl class="type">
<dt id="c.qdma_dev_qmax_state">
enum <code class="descname">qdma_dev_qmax_state</code><a class="headerlink" href="#c.qdma_dev_qmax_state" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p><strong>Constants</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">QMAX_CFG_UNCONFIGURED</span></code></dt>
<dd>device qmax not configured</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QMAX_CFG_INITIAL</span></code></dt>
<dd>device qmax configured with initial default values</dd>
<dt><code class="docutils literal notranslate"><span class="pre">QMAX_CFG_USER</span></code></dt>
<dd>device qmax configured from sysfs as per user choice</dd>
</dl>
<p><strong>Description</strong></p>
<p>Each PF/VF device can be configured with 0 or more number of queues.
When the queue is not assigned to any device, device is in unfonfigured state.
When PF/VF is instatiated, it has the default number of queues assigned
and the device is in initial state. Sysfs interface enables the users to
alter the default number of queues assigned to a device and it moves to
user configured state.</p>
<dl class="function">
<dt id="c.QDMA_DEV_NAME_MAXLEN">
<code class="descname">QDMA_DEV_NAME_MAXLEN</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#c.QDMA_DEV_NAME_MAXLEN" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p><strong>Parameters</strong></p>
<dl class="type">
<dt id="c.qdma_dev_conf">
struct <code class="descname">qdma_dev_conf</code><a class="headerlink" href="#c.qdma_dev_conf" title="Permalink to this definition">¶</a></dt>
<dd><p>device qdma property.</p>
</dd></dl>

<p><strong>Definition</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre>struct qdma_dev_conf {
  struct pci_dev * pdev;
  unsigned short rsvd2;
  u8 zerolen_dma:1;
  u8 master_pf:1;
  u8 isr_top_q_en:1;
  u8 rsvd1:5;
  u8 vf_max;
  u8 intr_rngsz;
  u8 msix_qvec_max;
  unsigned long uld;
  enum qdma_drv_mode qdma_drv_mode;
  char name;
#ifdef RTL2_FEATURE_CONFIGURABLE_BAR
  char bar_num_config;
  char bar_num_user;
  char bar_num_bypass;
#endif
  char bar_num_config;
  char bar_num_user;
  char bar_num_bypass;
  char bar_num_stm;
  int qsets_base;
  u32 bdf;
  u32 idx;
  u8 tm_mode_en;
  u8 tm_one_cdh_en;
  void (* fp_user_isr_handler) (unsigned long dev_hndl, unsigned long uld);
  void (* fp_q_isr_top_dev) (unsigned long dev_hndl, unsigned long uld);
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">pdev</span></code></dt>
<dd>pointer to pci_dev</dd>
<dt><code class="docutils literal notranslate"><span class="pre">rsvd2</span></code></dt>
<dd>Reserved</dd>
<dt><code class="docutils literal notranslate"><span class="pre">zerolen_dma</span></code></dt>
<dd>Indicates whether zero length DMA is allowed or not</dd>
<dt><code class="docutils literal notranslate"><span class="pre">master_pf</span></code></dt>
<dd>Indicates whether the current pf is master_pf or not</dd>
<dt><code class="docutils literal notranslate"><span class="pre">isr_top_q_en</span></code></dt>
<dd>extra handling of per descq handling in top half (i.e., qdma_descq.fp_descq_isr_top will be set)</dd>
<dt><code class="docutils literal notranslate"><span class="pre">rsvd1</span></code></dt>
<dd>Reserved1</dd>
<dt><code class="docutils literal notranslate"><span class="pre">vf_max</span></code></dt>
<dd>Maximum number of virtual functions for current physical function</dd>
<dt><code class="docutils literal notranslate"><span class="pre">intr_rngsz</span></code></dt>
<dd>Interrupt ring size</dd>
<dt><code class="docutils literal notranslate"><span class="pre">msix_qvec_max</span></code></dt>
<dd>max. of vectors used for queues. libqdma update w/ actual #</dd>
<dt><code class="docutils literal notranslate"><span class="pre">uld</span></code></dt>
<dd>upper layer data, i.e. callback data</dd>
<dt><code class="docutils literal notranslate"><span class="pre">qdma_drv_mode</span></code></dt>
<dd>qdma driver mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">name</span></code></dt>
<dd>an unique string to identify the dev.
current format: qdma[pf|vf][idx] filled in by libqdma</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bar_num_config</span></code></dt>
<dd>dma config bar #, &lt; 0 not present</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bar_num_user</span></code></dt>
<dd>user bar</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bar_num_bypass</span></code></dt>
<dd>bypass bar</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bar_num_config</span></code></dt>
<dd>dma config bar #, &lt; 0 not present</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bar_num_user</span></code></dt>
<dd>user bar</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bar_num_bypass</span></code></dt>
<dd>bypass bar</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bar_num_stm</span></code></dt>
<dd>STM bar, PF only</dd>
<dt><code class="docutils literal notranslate"><span class="pre">qsets_base</span></code></dt>
<dd>queue base for this funciton</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bdf</span></code></dt>
<dd>device index</dd>
<dt><code class="docutils literal notranslate"><span class="pre">idx</span></code></dt>
<dd>index of device in device list</dd>
<dt><code class="docutils literal notranslate"><span class="pre">tm_mode_en</span></code></dt>
<dd>xmit in traffic manager mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">tm_one_cdh_en</span></code></dt>
<dd>enable 1 CDH for Traffic Manager</dd>
<dt><code class="docutils literal notranslate"><span class="pre">fp_user_isr_handler</span></code></dt>
<dd>user interrupt, if null, default libqdma handler is used</dd>
<dt><code class="docutils literal notranslate"><span class="pre">fp_q_isr_top_dev</span></code></dt>
<dd>Q interrupt top, per-device addtional handling code</dd>
</dl>
<p><strong>NOTE</strong></p>
<dl class="docutils">
<dt>if any of the max requested is less than supported, the value will</dt>
<dd>be updated</dd>
</dl>
<dl class="function">
<dt id="c.qdma_device_open">
int <code class="descname">qdma_device_open</code><span class="sig-paren">(</span>const char *<em>&nbsp;mod_name</em>, struct <a class="reference internal" href="#c.qdma_dev_conf" title="qdma_dev_conf">qdma_dev_conf</a> *<em>&nbsp;conf</em>, unsigned long *<em>&nbsp;dev_hndl</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_open" title="Permalink to this definition">¶</a></dt>
<dd><p>read the pci bars and configure the fpga This API should be called from <code class="xref c c-func docutils literal notranslate"><span class="pre">probe()</span></code></p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*</span> <span class="pre">mod_name</span></code></dt>
<dd>the module name, used for request_irq</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_dev_conf</span> <span class="pre">*</span> <span class="pre">conf</span></code></dt>
<dd>device configuration</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">*</span> <span class="pre">dev_hndl</span></code></dt>
<dd>an opaque handle for libqdma to identify the device</dd>
</dl>
<p><strong>Description</strong></p>
<p>User interrupt will not be enabled until <code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_user_isr_enable()</span></code> is called</p>
<p><strong>Return</strong></p>
<p>QDMA_OPERATION_SUCCESSFUL in case of success and &lt;0 in case of error</p>
<dl class="function">
<dt id="c.qdma_device_close">
void <code class="descname">qdma_device_close</code><span class="sig-paren">(</span>struct pci_dev *<em>&nbsp;pdev</em>, unsigned long<em>&nbsp;dev_hndl</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_close" title="Permalink to this definition">¶</a></dt>
<dd><p>prepare fpga for removal: disable all interrupts (users and qdma) and release all resources.This API should be called from <code class="xref c c-func docutils literal notranslate"><span class="pre">remove()</span></code></p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">pci_dev</span> <span class="pre">*</span> <span class="pre">pdev</span></code></dt>
<dd>ptr to struct pci_dev</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl retured from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
</dl>
<dl class="function">
<dt id="c.qdma_device_offline">
void <code class="descname">qdma_device_offline</code><span class="sig-paren">(</span>struct pci_dev *<em>&nbsp;pdev</em>, unsigned long<em>&nbsp;dev_hndl</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_offline" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the device in offline mode</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">pci_dev</span> <span class="pre">*</span> <span class="pre">pdev</span></code></dt>
<dd>ptr to struct pci_dev</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl retured from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_online">
int <code class="descname">qdma_device_online</code><span class="sig-paren">(</span>struct pci_dev *<em>&nbsp;pdev</em>, unsigned long<em>&nbsp;dev_hndl</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_online" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the device in online mode and re-initialze it</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">pci_dev</span> <span class="pre">*</span> <span class="pre">pdev</span></code></dt>
<dd>ptr to struct pci_dev</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl retured from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_flr_quirk_set">
int <code class="descname">qdma_device_flr_quirk_set</code><span class="sig-paren">(</span>struct pci_dev *<em>&nbsp;pdev</em>, unsigned long<em>&nbsp;dev_hndl</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_flr_quirk_set" title="Permalink to this definition">¶</a></dt>
<dd><p>start pre-flr processing</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">pci_dev</span> <span class="pre">*</span> <span class="pre">pdev</span></code></dt>
<dd>ptr to struct pci_dev</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_flr_quirk_check">
int <code class="descname">qdma_device_flr_quirk_check</code><span class="sig-paren">(</span>struct pci_dev *<em>&nbsp;pdev</em>, unsigned long<em>&nbsp;dev_hndl</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_flr_quirk_check" title="Permalink to this definition">¶</a></dt>
<dd><p>check if pre-flr processing completed</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">pci_dev</span> <span class="pre">*</span> <span class="pre">pdev</span></code></dt>
<dd>ptr to struct pci_dev</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl retunred from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_get_config">
int <code class="descname">qdma_device_get_config</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, struct <a class="reference internal" href="#c.qdma_dev_conf" title="qdma_dev_conf">qdma_dev_conf</a> *<em>&nbsp;conf</em>, char *<em>&nbsp;ebuf</em>, int<em>&nbsp;ebuflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_get_config" title="Permalink to this definition">¶</a></dt>
<dd><p>retrieve the current device configuration</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl retunred from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_dev_conf</span> <span class="pre">*</span> <span class="pre">conf</span></code></dt>
<dd>device configuration</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">ebuf</span></code></dt>
<dd>error message buffer, can be NULL/0 (i.e., optional)</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">ebuflen</span></code></dt>
<dd>input buffer length</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_clear_stats">
int <code class="descname">qdma_device_clear_stats</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_clear_stats" title="Permalink to this definition">¶</a></dt>
<dd><p>clear device statistics</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl retunred from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_get_mmh2c_pkts">
int <code class="descname">qdma_device_get_mmh2c_pkts</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long long *<em>&nbsp;mmh2c_pkts</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_get_mmh2c_pkts" title="Permalink to this definition">¶</a></dt>
<dd><p>get mm h2c packets processed</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl retunred from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">long</span> <span class="pre">*</span> <span class="pre">mmh2c_pkts</span></code></dt>
<dd>number of mm h2c packets processed</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_get_mmc2h_pkts">
int <code class="descname">qdma_device_get_mmc2h_pkts</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long long *<em>&nbsp;mmc2h_pkts</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_get_mmc2h_pkts" title="Permalink to this definition">¶</a></dt>
<dd><p>get mm c2h packets processed</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl retunred from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">long</span> <span class="pre">*</span> <span class="pre">mmc2h_pkts</span></code></dt>
<dd>number of mm c2h packets processed</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_get_sth2c_pkts">
int <code class="descname">qdma_device_get_sth2c_pkts</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long long *<em>&nbsp;sth2c_pkts</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_get_sth2c_pkts" title="Permalink to this definition">¶</a></dt>
<dd><p>get st h2c packets processed</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl retunred from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">long</span> <span class="pre">*</span> <span class="pre">sth2c_pkts</span></code></dt>
<dd>number of st h2c packets processed</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_get_stc2h_pkts">
int <code class="descname">qdma_device_get_stc2h_pkts</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long long *<em>&nbsp;stc2h_pkts</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_get_stc2h_pkts" title="Permalink to this definition">¶</a></dt>
<dd><p>get st c2h packets processed</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl retunred from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">long</span> <span class="pre">*</span> <span class="pre">stc2h_pkts</span></code></dt>
<dd>number of st c2h packets processed</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_set_config">
int <code class="descname">qdma_device_set_config</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, struct <a class="reference internal" href="#c.qdma_dev_conf" title="qdma_dev_conf">qdma_dev_conf</a> *<em>&nbsp;conf</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_set_config" title="Permalink to this definition">¶</a></dt>
<dd><p>set the current device configuration</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_dev_conf</span> <span class="pre">*</span> <span class="pre">conf</span></code></dt>
<dd>device configuration to set</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_device_sriov_config">
int <code class="descname">qdma_device_sriov_config</code><span class="sig-paren">(</span>struct pci_dev *<em>&nbsp;pdev</em>, unsigned long<em>&nbsp;dev_hndl</em>, int<em>&nbsp;num_vfs</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_sriov_config" title="Permalink to this definition">¶</a></dt>
<dd><p>configure sriov</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">pci_dev</span> <span class="pre">*</span> <span class="pre">pdev</span></code></dt>
<dd>ptr to struct pci_dev</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">num_vfs</span></code></dt>
<dd># of VFs to be instantiated</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<p>configures sriov</p>
<dl class="function">
<dt id="c.qdma_device_read_config_register">
unsigned int <code class="descname">qdma_device_read_config_register</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned int<em>&nbsp;reg_addr</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_read_config_register" title="Permalink to this definition">¶</a></dt>
<dd><p>read dma config register</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">reg_addr</span></code></dt>
<dd>register address</dd>
</dl>
<p><strong>Return</strong></p>
<p>value of the config register</p>
<p>reads dma config register</p>
<dl class="function">
<dt id="c.qdma_device_write_config_register">
void <code class="descname">qdma_device_write_config_register</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned int<em>&nbsp;reg_addr</em>, u32<em>&nbsp;value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_write_config_register" title="Permalink to this definition">¶</a></dt>
<dd><p>write dma config register</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">reg_addr</span></code></dt>
<dd>register address</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u32</span> <span class="pre">value</span></code></dt>
<dd>register value to be writen</dd>
</dl>
<p><strong>Description</strong></p>
<p>writes dma config register</p>
<dl class="type">
<dt id="c.qdma_version_info">
struct <code class="descname">qdma_version_info</code><a class="headerlink" href="#c.qdma_version_info" title="Permalink to this definition">¶</a></dt>
<dd><p>defines the per-device version information</p>
</dd></dl>

<p><strong>Definition</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre>struct qdma_version_info {
  u8 rtl_version;
  char rtl_version_str;
  u8 vivado_release_id;
  char vivado_release_str;
  u8 everest_ip;
  char everest_ip_str;
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">rtl_version</span></code></dt>
<dd>Hardware RTL version</dd>
<dt><code class="docutils literal notranslate"><span class="pre">rtl_version_str</span></code></dt>
<dd>Version string</dd>
<dt><code class="docutils literal notranslate"><span class="pre">vivado_release_id</span></code></dt>
<dd>Vivado release id</dd>
<dt><code class="docutils literal notranslate"><span class="pre">vivado_release_str</span></code></dt>
<dd>Release string</dd>
<dt><code class="docutils literal notranslate"><span class="pre">everest_ip</span></code></dt>
<dd>Everest IP version</dd>
<dt><code class="docutils literal notranslate"><span class="pre">everest_ip_str</span></code></dt>
<dd>Everest IP version string</dd>
</dl>
<dl class="function">
<dt id="c.qdma_device_version_info">
int <code class="descname">qdma_device_version_info</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, struct <a class="reference internal" href="#c.qdma_version_info" title="qdma_version_info">qdma_version_info</a> *<em>&nbsp;version_info</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_device_version_info" title="Permalink to this definition">¶</a></dt>
<dd><p>retrieve the RTL version , Vivado Release ID and Everest IP info</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>handle returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_version_info</span> <span class="pre">*</span> <span class="pre">version_info</span></code></dt>
<dd>pointer to hold all the version details</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<p>retrieves the RTL version , Vivado Release ID and Everest IP info</p>
<dl class="function">
<dt id="c.qdma_software_version_info">
int <code class="descname">qdma_software_version_info</code><span class="sig-paren">(</span>char *<em>&nbsp;software_version</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_software_version_info" title="Permalink to this definition">¶</a></dt>
<dd><p>retrieve the software version</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">software_version</span></code></dt>
<dd>A pointer to a null-terminated string</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<p>retrieves the software version</p>
<dl class="type">
<dt id="c.global_csr_conf">
struct <code class="descname">global_csr_conf</code><a class="headerlink" href="#c.global_csr_conf" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p><strong>Definition</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre>struct global_csr_conf {
  unsigned int ring_sz;
  unsigned int c2h_timer_cnt;
  unsigned int c2h_cnt_th;
  unsigned int c2h_buf_sz;
  unsigned int cmpl_status_acc;
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">ring_sz</span></code></dt>
<dd>Descriptor ring size ie. queue depth</dd>
<dt><code class="docutils literal notranslate"><span class="pre">c2h_timer_cnt</span></code></dt>
<dd>C2H timer count  list</dd>
<dt><code class="docutils literal notranslate"><span class="pre">c2h_cnt_th</span></code></dt>
<dd>C2H counter threshold list</dd>
<dt><code class="docutils literal notranslate"><span class="pre">c2h_buf_sz</span></code></dt>
<dd>C2H buffer size list</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_status_acc</span></code></dt>
<dd>wireback acculation enable/disable</dd>
</dl>
<dl class="function">
<dt id="c.qdma_global_csr_get">
int <code class="descname">qdma_global_csr_get</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, struct <a class="reference internal" href="#c.global_csr_conf" title="global_csr_conf">global_csr_conf</a> *<em>&nbsp;csr</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_global_csr_get" title="Permalink to this definition">¶</a></dt>
<dd><p>retrieve the global csr settings</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>handle returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">global_csr_conf</span> <span class="pre">*</span> <span class="pre">csr</span></code></dt>
<dd>data structures to hold the csr values</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<p>retrieves the global csr settings</p>
<dl class="function">
<dt id="c.qdma_global_csr_set">
int <code class="descname">qdma_global_csr_set</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, struct <a class="reference internal" href="#c.global_csr_conf" title="global_csr_conf">global_csr_conf</a> *<em>&nbsp;csr</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_global_csr_set" title="Permalink to this definition">¶</a></dt>
<dd><p>set the global csr values</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>handle returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">global_csr_conf</span> <span class="pre">*</span> <span class="pre">csr</span></code></dt>
<dd>data structures to hold the csr values</dd>
</dl>
<p><strong>NOTE</strong></p>
<p>for set, libqdma will enforce the access control</p>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<p>sets the global csr values</p>
<dl class="type">
<dt id="c.cmpt_desc_sz_t">
enum <code class="descname">cmpt_desc_sz_t</code><a class="headerlink" href="#c.cmpt_desc_sz_t" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p><strong>Constants</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">CMPT_DESC_SZ_8B</span></code></dt>
<dd>completion size 8B</dd>
<dt><code class="docutils literal notranslate"><span class="pre">CMPT_DESC_SZ_16B</span></code></dt>
<dd>completion size 16B</dd>
<dt><code class="docutils literal notranslate"><span class="pre">CMPT_DESC_SZ_32B</span></code></dt>
<dd>completion size 32B</dd>
<dt><code class="docutils literal notranslate"><span class="pre">CMPT_DESC_SZ_64B</span></code></dt>
<dd>completion size 64B</dd>
</dl>
<dl class="type">
<dt id="c.desc_sz_t">
enum <code class="descname">desc_sz_t</code><a class="headerlink" href="#c.desc_sz_t" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p><strong>Constants</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">DESC_SZ_8B</span></code></dt>
<dd>descriptor size 8B</dd>
<dt><code class="docutils literal notranslate"><span class="pre">DESC_SZ_16B</span></code></dt>
<dd>descriptor size 16B</dd>
<dt><code class="docutils literal notranslate"><span class="pre">DESC_SZ_32B</span></code></dt>
<dd>descriptor size 32B</dd>
<dt><code class="docutils literal notranslate"><span class="pre">DESC_SZ_64B</span></code></dt>
<dd>descriptor size 64B</dd>
</dl>
<dl class="type">
<dt id="c.tigger_mode_t">
enum <code class="descname">tigger_mode_t</code><a class="headerlink" href="#c.tigger_mode_t" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p><strong>Constants</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">TRIG_MODE_DISABLE</span></code></dt>
<dd>disable trigger mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">TRIG_MODE_ANY</span></code></dt>
<dd>any trigger mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">TRIG_MODE_COUNTER</span></code></dt>
<dd>counter trigger mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">TRIG_MODE_USER</span></code></dt>
<dd>trigger mode of user choice</dd>
<dt><code class="docutils literal notranslate"><span class="pre">TRIG_MODE_TIMER</span></code></dt>
<dd>timer trigger mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">TRIG_MODE_COMBO</span></code></dt>
<dd>timer and counter combo trigger mode</dd>
</dl>
<dl class="type">
<dt id="c.qdma_sw_sg">
struct <code class="descname">qdma_sw_sg</code><a class="headerlink" href="#c.qdma_sw_sg" title="Permalink to this definition">¶</a></dt>
<dd><p>qdma scatter gather request</p>
</dd></dl>

<p><strong>Definition</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre>struct qdma_sw_sg {
  struct qdma_sw_sg * next;
  struct page * pg;
  unsigned int offset;
  unsigned int len;
  dma_addr_t dma_addr;
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">next</span></code></dt>
<dd>pointer to next page</dd>
<dt><code class="docutils literal notranslate"><span class="pre">pg</span></code></dt>
<dd>pointer to current page</dd>
<dt><code class="docutils literal notranslate"><span class="pre">offset</span></code></dt>
<dd>offset in current page</dd>
<dt><code class="docutils literal notranslate"><span class="pre">len</span></code></dt>
<dd>length of the page</dd>
<dt><code class="docutils literal notranslate"><span class="pre">dma_addr</span></code></dt>
<dd>dma address of the allocated page</dd>
</dl>
<dl class="type">
<dt id="c.qdma_queue_conf">
struct <code class="descname">qdma_queue_conf</code><a class="headerlink" href="#c.qdma_queue_conf" title="Permalink to this definition">¶</a></dt>
<dd><p>qdma configuration parameters</p>
</dd></dl>

<p><strong>Definition</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre>struct qdma_queue_conf {
  u32 qidx:24;
  u32 st:1;
  u32 c2h:1;
  u32 pipe:1;
  u32 irq_en:1;
  u32 desc_rng_sz_idx:4;
  u8 cmpl_status_acc_en:1;
  u8 cmpl_status_pend_chk:1;
  u8 desc_bypass:1;
  u8 pfetch_en:1;
  u8 fetch_credit:1;
  u8 st_pkt_mode:1;
  u8 c2h_use_fl:1;
  u8 c2h_buf_sz_idx:4;
  u8 cmpl_rng_sz_idx:4;
  u8 cmpl_desc_sz:2;
  u8 cmpl_stat_en:1;
  u8 cmpl_udd_en:1;
  u8 cmpl_timer_idx:4;
  u8 cmpl_cnt_th_idx:4;
  u8 cmpl_trig_mode:3;
  u8 cmpl_en_intr:1;
  u8 sw_desc_sz:2;
  u8 pfetch_bypass:1;
  u8 cmpl_ovf_chk_dis:1;
  u8 port_id:3;
  u8 at:1;
  u8 cdh_max;
  u8 pipe_gl_max;
  u8 pipe_flow_id;
  u8 pipe_slr_id;
  u16 pipe_tdest;
  unsigned long quld;
  void (* fp_descq_isr_top) (unsigned long qhndl, unsigned long quld);
  int (* fp_descq_c2h_packet) (unsigned long qhndl, unsigned long quld,unsigned int len, unsigned int sgcnt, struct qdma_sw_sg *sgl, void *udd);
  char name;
  unsigned int rngsz;
  unsigned int rngsz_cmpt;
  unsigned int c2h_bufsz;
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">qidx</span></code></dt>
<dd>0xFFFF: libqdma choose the queue idx 0 ~ (qdma_dev_conf.qsets_max - 1) the calling function choose the queue idx</dd>
<dt><code class="docutils literal notranslate"><span class="pre">st</span></code></dt>
<dd>Indicates the streaming mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">c2h</span></code></dt>
<dd>c2h direction</dd>
<dt><code class="docutils literal notranslate"><span class="pre">pipe</span></code></dt>
<dd>SDx only: inter-kernel communication pipe</dd>
<dt><code class="docutils literal notranslate"><span class="pre">irq_en</span></code></dt>
<dd>poll or interrupt</dd>
<dt><code class="docutils literal notranslate"><span class="pre">desc_rng_sz_idx</span></code></dt>
<dd>global_csr_conf.ringsz[N]</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_status_acc_en</span></code></dt>
<dd>sw context.cmpl_status_acc_en</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_status_pend_chk</span></code></dt>
<dd>sw context.cmpl_stauts_pend_chk</dd>
<dt><code class="docutils literal notranslate"><span class="pre">desc_bypass</span></code></dt>
<dd>send descriptor to bypass out</dd>
<dt><code class="docutils literal notranslate"><span class="pre">pfetch_en</span></code></dt>
<dd>descriptor prefetch enable control</dd>
<dt><code class="docutils literal notranslate"><span class="pre">fetch_credit</span></code></dt>
<dd>sw context.frcd_en[32]</dd>
<dt><code class="docutils literal notranslate"><span class="pre">st_pkt_mode</span></code></dt>
<dd>SDx only: ST packet mode (i.e., with TLAST to identify the packet boundary)</dd>
<dt><code class="docutils literal notranslate"><span class="pre">c2h_use_fl</span></code></dt>
<dd>c2h use pre-alloc free list</dd>
<dt><code class="docutils literal notranslate"><span class="pre">c2h_buf_sz_idx</span></code></dt>
<dd>global_csr_conf.c2h_buf_sz[N]</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_rng_sz_idx</span></code></dt>
<dd>global_csr_conf.ringsz[N]</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_desc_sz</span></code></dt>
<dd>C2H ST cmpt + immediate data, desc_sz_t</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_stat_en</span></code></dt>
<dd>enable status desc. for CMPT</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_udd_en</span></code></dt>
<dd>C2H Completion entry user-defined data</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_timer_idx</span></code></dt>
<dd>global_csr_conf.c2h_timer_cnt[N]</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_cnt_th_idx</span></code></dt>
<dd>global_csr_conf.c2h_cnt_th[N]</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_trig_mode</span></code></dt>
<dd>tigger_mode_t</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_en_intr</span></code></dt>
<dd>enable interrupt for CMPT</dd>
<dt><code class="docutils literal notranslate"><span class="pre">sw_desc_sz</span></code></dt>
<dd>SW Context desc size, desc_sz_t</dd>
<dt><code class="docutils literal notranslate"><span class="pre">pfetch_bypass</span></code></dt>
<dd>prefetch bypass en</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_ovf_chk_dis</span></code></dt>
<dd>OVF_DIS C2H ST over flow disable</dd>
<dt><code class="docutils literal notranslate"><span class="pre">port_id</span></code></dt>
<dd>Port ID</dd>
<dt><code class="docutils literal notranslate"><span class="pre">at</span></code></dt>
<dd>Address Translation</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cdh_max</span></code></dt>
<dd>max 16. CDH length per packet</dd>
<dt><code class="docutils literal notranslate"><span class="pre">pipe_gl_max</span></code></dt>
<dd>&lt;= 7, max # gather buf. per packet</dd>
<dt><code class="docutils literal notranslate"><span class="pre">pipe_flow_id</span></code></dt>
<dd>pipe flow id</dd>
<dt><code class="docutils literal notranslate"><span class="pre">pipe_slr_id</span></code></dt>
<dd>pipe SLR id</dd>
<dt><code class="docutils literal notranslate"><span class="pre">pipe_tdest</span></code></dt>
<dd>pipe route id</dd>
<dt><code class="docutils literal notranslate"><span class="pre">quld</span></code></dt>
<dd>user provided per-Q irq handler</dd>
<dt><code class="docutils literal notranslate"><span class="pre">fp_descq_isr_top</span></code></dt>
<dd>Q interrupt top, per-queue additional handling code for example, network rx napi_schedule(<code class="xref c c-type docutils literal notranslate"><span class="pre">Q-&gt;napi</span></code>)</dd>
<dt><code class="docutils literal notranslate"><span class="pre">fp_descq_c2h_packet</span></code></dt>
<dd><dl class="first docutils">
<dt>optional rx packet handler:</dt>
<dd>called from irq BH (i.e.:c:func:<cite>qdma_queue_service_bh()</cite>)</dd>
</dl>
<p>udd: user defined data in the completion entry
sgcnt / sgl: packet data in scatter-gather list</p>
<blockquote>
<div><dl class="docutils">
<dt>NOTE: a. do NOT modify any field of sgl</dt>
<dd><ol class="first last loweralpha simple" start="2">
<li>if zero copy, do a <code class="xref c c-func docutils literal notranslate"><span class="pre">get_page()</span></code> to prevent page freeing</li>
<li>do loop through the sgl with sg-&gt;next and stop
at sgcnt. the last sg may not have sg-&gt;next = NULL</li>
</ol>
</dd>
</dl>
</div></blockquote>
<dl class="docutils">
<dt>Returns:</dt>
<dd>0 to allow libqdma free/re-task the sgl
&lt; 0, libqdma will keep the packet for processing again</dd>
</dl>
<p>A single packet could contain:
in the case of c2h_udd_en = 1:</p>
<p class="last">udd only (udd valid, sgcnt = 0, sgl = NULL), or
udd + packdet data in the case of c2h_udd_en = 0:
packet data (udd = NULL, sgcnt &gt; 0 and sgl valid)</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">name</span></code></dt>
<dd>name of the qdma device</dd>
<dt><code class="docutils literal notranslate"><span class="pre">rngsz</span></code></dt>
<dd>ring size of the queue</dd>
<dt><code class="docutils literal notranslate"><span class="pre">rngsz_cmpt</span></code></dt>
<dd>completion ring size of the queue</dd>
<dt><code class="docutils literal notranslate"><span class="pre">c2h_bufsz</span></code></dt>
<dd>C2H buffer size</dd>
</dl>
<p><strong>Description</strong></p>
<p>qdma_queue_conf defines the per-dma Q property.
if any of the max requested is less than supported, the value will
be updated</p>
<dl class="function">
<dt id="c.qdma_queue_add">
int <code class="descname">qdma_queue_add</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, struct <a class="reference internal" href="#c.qdma_queue_conf" title="qdma_queue_conf">qdma_queue_conf</a> *<em>&nbsp;qconf</em>, unsigned long *<em>&nbsp;qhndl</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_add" title="Permalink to this definition">¶</a></dt>
<dd><p>add a queue</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_queue_conf</span> <span class="pre">*</span> <span class="pre">qconf</span></code></dt>
<dd>queue configuration parameters</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">*</span> <span class="pre">qhndl</span></code></dt>
<dd>list of unsigned long values that are the opaque qhndl</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_reconfig">
int <code class="descname">qdma_queue_reconfig</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, struct <a class="reference internal" href="#c.qdma_queue_conf" title="qdma_queue_conf">qdma_queue_conf</a> *<em>&nbsp;qconf</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_reconfig" title="Permalink to this definition">¶</a></dt>
<dd><p>reconfigure the queue</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>qdma device handle</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>queue index</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_queue_conf</span> <span class="pre">*</span> <span class="pre">qconf</span></code></dt>
<dd>queue configuration</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_start">
int <code class="descname">qdma_queue_start</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_start" title="Permalink to this definition">¶</a></dt>
<dd><p>start a queue (i.e, online, ready for dma)</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>the opaque qhndl</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_stop">
int <code class="descname">qdma_queue_stop</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_stop" title="Permalink to this definition">¶</a></dt>
<dd><p>stop a queue (i.e., offline, NOT ready for dma)</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>the opaque qhndl</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_prog_stm">
int <code class="descname">qdma_queue_prog_stm</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_prog_stm" title="Permalink to this definition">¶</a></dt>
<dd><p>Program STM for queue (context, map, etc)</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>queue index</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_remove">
int <code class="descname">qdma_queue_remove</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_remove" title="Permalink to this definition">¶</a></dt>
<dd><p>remove a queue</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>the opaque qhndl</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success and &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_get_config">
struct <a class="reference internal" href="#c.qdma_queue_conf" title="qdma_queue_conf">qdma_queue_conf</a> * <code class="descname">qdma_queue_get_config</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_get_config" title="Permalink to this definition">¶</a></dt>
<dd><p>retrieve the configuration of a queue</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>an opaque queue handle of type unsigned long</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<dl class="docutils">
<dt>if optional message buffer used then strlen of buf,</dt>
<dd>otherwise QDMA_OPERATION_SUCCESSFUL and &lt;0 for error</dd>
</dl>
<dl class="function">
<dt id="c.qdma_queue_list">
int <code class="descname">qdma_queue_list</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_list" title="Permalink to this definition">¶</a></dt>
<dd><p>display all configured queues in a string buffer</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<dl class="docutils">
<dt>if optional message buffer used then strlen of buf,</dt>
<dd>otherwise QDMA_OPERATION_SUCCESSFUL and &lt;0 for error</dd>
</dl>
<dl class="function">
<dt id="c.qdma_queue_dump">
int <code class="descname">qdma_queue_dump</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_dump" title="Permalink to this definition">¶</a></dt>
<dd><p>display a queue’s state in a string buffer</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>an opaque queue handle of type unsigned long</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<dl class="docutils">
<dt>if optional message buffer used then strlen of buf,</dt>
<dd>otherwise QDMA_OPERATION_SUCCESSFUL and &lt;0 for error</dd>
</dl>
<dl class="function">
<dt id="c.qdma_queue_dump_desc">
int <code class="descname">qdma_queue_dump_desc</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, unsigned int<em>&nbsp;start</em>, unsigned int<em>&nbsp;end</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_dump_desc" title="Permalink to this definition">¶</a></dt>
<dd><p>display a queue’s descriptor ring from index start ~ end in a string buffer</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>an opaque queue handle of type unsigned long</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">start</span></code></dt>
<dd>start index</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">end</span></code></dt>
<dd>end index</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<dl class="docutils">
<dt>if optional message buffer used then strlen of buf,</dt>
<dd>otherwise QDMA_OPERATION_SUCCESSFUL and &lt;0 for error</dd>
</dl>
<dl class="function">
<dt id="c.qdma_queue_dump_cmpt">
int <code class="descname">qdma_queue_dump_cmpt</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, unsigned int<em>&nbsp;start</em>, unsigned int<em>&nbsp;end</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_dump_cmpt" title="Permalink to this definition">¶</a></dt>
<dd><p>display a queue’s descriptor ring from index start ~ end in a string buffer</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>an opaque queue handle of type unsigned long</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">start</span></code></dt>
<dd>start index</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">end</span></code></dt>
<dd>end index</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<dl class="docutils">
<dt>if optional message buffer used then strlen of buf,</dt>
<dd>otherwise QDMA_OPERATION_SUCCESSFUL and &lt;0 for error</dd>
</dl>
<dl class="function">
<dt id="c.qdma_queue_set_err_induction">
int <code class="descname">qdma_queue_set_err_induction</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, u32<em>&nbsp;err</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_set_err_induction" title="Permalink to this definition">¶</a></dt>
<dd><p>Induce the error</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>error id</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u32</span> <span class="pre">err</span></code></dt>
<dd>error info</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message buffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<dl class="docutils">
<dt>if optional message buffer used then strlen of buf,</dt>
<dd>otherwise QDMA_OPERATION_SUCCESSFUL and &lt;0 for error</dd>
</dl>
<dl class="type">
<dt id="c.qdma_request">
struct <code class="descname">qdma_request</code><a class="headerlink" href="#c.qdma_request" title="Permalink to this definition">¶</a></dt>
<dd><p>qdma request for read or write</p>
</dd></dl>

<p><strong>Definition</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre>struct qdma_request {
  unsigned char opaque;
  unsigned long uld_data;
  int (* fp_done) (struct qdma_request *, unsigned int bytes_done, int err);
  unsigned int timeout_ms;
  unsigned int count;
  u64 ep_addr;
  u8 no_memcpy:1;
  u8 write:1;
  u8 dma_mapped:1;
  u8 h2c_eot:1;
  u8 udd_len;
  unsigned int sgcnt;
  struct qdma_sw_sg * sgl;
  u8 udd;
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">opaque</span></code></dt>
<dd>private to the dma driver, do NOT touch</dd>
<dt><code class="docutils literal notranslate"><span class="pre">uld_data</span></code></dt>
<dd>filled in by the calling function for the calling function</dd>
<dt><code class="docutils literal notranslate"><span class="pre">fp_done</span></code></dt>
<dd>set fp_done for non-blocking mode</dd>
<dt><code class="docutils literal notranslate"><span class="pre">timeout_ms</span></code></dt>
<dd>timeout in mili-seconds, 0 - no timeout</dd>
<dt><code class="docutils literal notranslate"><span class="pre">count</span></code></dt>
<dd>total data size</dd>
<dt><code class="docutils literal notranslate"><span class="pre">ep_addr</span></code></dt>
<dd>MM only, DDR/BRAM memory addr</dd>
<dt><code class="docutils literal notranslate"><span class="pre">no_memcpy</span></code></dt>
<dd>flag to indicate if memcpy is required</dd>
<dt><code class="docutils literal notranslate"><span class="pre">write</span></code></dt>
<dd>if write to the device</dd>
<dt><code class="docutils literal notranslate"><span class="pre">dma_mapped</span></code></dt>
<dd>if sgt is already dma mapped</dd>
<dt><code class="docutils literal notranslate"><span class="pre">h2c_eot</span></code></dt>
<dd>user defined data present</dd>
<dt><code class="docutils literal notranslate"><span class="pre">udd_len</span></code></dt>
<dd>indicates end of transfer towards user kernel</dd>
<dt><code class="docutils literal notranslate"><span class="pre">sgcnt</span></code></dt>
<dd># of scatter-gather entries &lt; 64K</dd>
<dt><code class="docutils literal notranslate"><span class="pre">sgl</span></code></dt>
<dd>scatter-gather list of data bufs</dd>
<dt><code class="docutils literal notranslate"><span class="pre">udd</span></code></dt>
<dd>udd data</dd>
</dl>
<p><strong>Description</strong></p>
<dl class="function">
<dt id="c.qdma_request_submit">
ssize_t <code class="descname">qdma_request_submit</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, struct <a class="reference internal" href="#c.qdma_request" title="qdma_request">qdma_request</a> *<em>&nbsp;req</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_request_submit" title="Permalink to this definition">¶</a></dt>
<dd><p>submit a scatter-gather list of data for dma operation (for both read and write)</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>queue index</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_request</span> <span class="pre">*</span> <span class="pre">req</span></code></dt>
<dd>qdma request</dd>
</dl>
<p><strong>Return</strong></p>
<p># of bytes transferred for success and  &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_batch_request_submit">
ssize_t <code class="descname">qdma_batch_request_submit</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;id</em>, unsigned long<em>&nbsp;count</em>, struct <a class="reference internal" href="#c.qdma_request" title="qdma_request">qdma_request</a> **<em>&nbsp;reqv</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_batch_request_submit" title="Permalink to this definition">¶</a></dt>
<dd><p>submit a scatter-gather list of data for dma operation (for both read and write)</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">id</span></code></dt>
<dd>queue index</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">count</span></code></dt>
<dd>number of requests</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_request</span> <span class="pre">**</span> <span class="pre">reqv</span></code></dt>
<dd>qdma request</dd>
</dl>
<p><strong>Return</strong></p>
<p># of bytes transferred for success and  &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_c2h_peek">
int <code class="descname">qdma_queue_c2h_peek</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;qhndl</em>, unsigned int *<em>&nbsp;udd_cnt</em>, unsigned int *<em>&nbsp;pkt_cnt</em>, unsigned int *<em>&nbsp;data_len</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_c2h_peek" title="Permalink to this definition">¶</a></dt>
<dd><p>peek a receive (c2h) queue</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">qhndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_queue_add" title="qdma_queue_add"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_queue_add()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">*</span> <span class="pre">udd_cnt</span></code></dt>
<dd># of udd received</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">*</span> <span class="pre">pkt_cnt</span></code></dt>
<dd># of packets received</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">*</span> <span class="pre">data_len</span></code></dt>
<dd># of bytes of packet data received</dd>
</dl>
<p><strong>Description</strong></p>
<p>filled in by libqdma:</p>
<p><strong>Return</strong></p>
<p># of packets received in the Q or &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_avail_desc">
int <code class="descname">qdma_queue_avail_desc</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;qhndl</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_avail_desc" title="Permalink to this definition">¶</a></dt>
<dd><p>query of # of free descriptor</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">qhndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_queue_add" title="qdma_queue_add"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_queue_add()</span></code></a></dd>
</dl>
<p><strong>Return</strong></p>
<p># of available desc in the queue or &lt;0 for error</p>
<dl class="type">
<dt id="c.qdma_cmpl_ctrl">
struct <code class="descname">qdma_cmpl_ctrl</code><a class="headerlink" href="#c.qdma_cmpl_ctrl" title="Permalink to this definition">¶</a></dt>
<dd><p>completion control</p>
</dd></dl>

<p><strong>Definition</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre>struct qdma_cmpl_ctrl {
  u8 cnt_th_idx:4;
  u8 timer_idx:4;
  u8 trigger_mode:3;
  u8 en_stat_desc:1;
  u8 cmpl_en_intr:1;
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">cnt_th_idx</span></code></dt>
<dd>global_csr_conf.c2h_cnt_th[N]</dd>
<dt><code class="docutils literal notranslate"><span class="pre">timer_idx</span></code></dt>
<dd>global_csr_conf.c2h_timer_cnt[N]</dd>
<dt><code class="docutils literal notranslate"><span class="pre">trigger_mode</span></code></dt>
<dd>tigger_mode_t</dd>
<dt><code class="docutils literal notranslate"><span class="pre">en_stat_desc</span></code></dt>
<dd>enable status desc. for CMPT</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cmpl_en_intr</span></code></dt>
<dd>enable interrupt for CMPT</dd>
</dl>
<dl class="function">
<dt id="c.qdma_queue_cmpl_ctrl">
int <code class="descname">qdma_queue_cmpl_ctrl</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;qhndl</em>, struct <a class="reference internal" href="#c.qdma_cmpl_ctrl" title="qdma_cmpl_ctrl">qdma_cmpl_ctrl</a> *<em>&nbsp;cctrl</em>, bool<em>&nbsp;set</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_cmpl_ctrl" title="Permalink to this definition">¶</a></dt>
<dd><p>read/set the c2h Q’s completion control</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">qhndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_queue_add" title="qdma_queue_add"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_queue_add()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_cmpl_ctrl</span> <span class="pre">*</span> <span class="pre">cctrl</span></code></dt>
<dd>completion control</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bool</span> <span class="pre">set</span></code></dt>
<dd>read or set</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success or &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_packet_read">
int <code class="descname">qdma_queue_packet_read</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;qhndl</em>, struct <a class="reference internal" href="#c.qdma_request" title="qdma_request">qdma_request</a> *<em>&nbsp;req</em>, struct <a class="reference internal" href="#c.qdma_cmpl_ctrl" title="qdma_cmpl_ctrl">qdma_cmpl_ctrl</a> *<em>&nbsp;cctrl</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_packet_read" title="Permalink to this definition">¶</a></dt>
<dd><p>read rcv’ed data (ST C2H dma operation)</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">qhndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_queue_add" title="qdma_queue_add"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_queue_add()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_request</span> <span class="pre">*</span> <span class="pre">req</span></code></dt>
<dd>pointer to the request data</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_cmpl_ctrl</span> <span class="pre">*</span> <span class="pre">cctrl</span></code></dt>
<dd>completion control, if no change is desired,
set it to NULL</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success or &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_packet_write">
int <code class="descname">qdma_queue_packet_write</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;qhndl</em>, struct <a class="reference internal" href="#c.qdma_request" title="qdma_request">qdma_request</a> *<em>&nbsp;req</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_packet_write" title="Permalink to this definition">¶</a></dt>
<dd><p>submit data for h2c dma operation</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">qhndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_queue_add" title="qdma_queue_add"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_queue_add()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">qdma_request</span> <span class="pre">*</span> <span class="pre">req</span></code></dt>
<dd>pointer to the list of packet data</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success or &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_queue_service">
void <code class="descname">qdma_queue_service</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;qhndl</em>, int<em>&nbsp;budget</em>, bool<em>&nbsp;c2h_upd_cmpl</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_queue_service" title="Permalink to this definition">¶</a></dt>
<dd><p>service the queue in the case of irq handler is registered by the user, the user should call <a class="reference internal" href="#c.qdma_queue_service" title="qdma_queue_service"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_queue_service()</span></code></a> in its interrupt handler to service the queue</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">qhndl</span></code></dt>
<dd>hndl returned from <a class="reference internal" href="#c.qdma_queue_add" title="qdma_queue_add"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_queue_add()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">budget</span></code></dt>
<dd>ST C2H only, max number of completions to be processed.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bool</span> <span class="pre">c2h_upd_cmpl</span></code></dt>
<dd>flag to update the completion</dd>
</dl>
<dl class="function">
<dt id="c.qdma_intr_ring_dump">
int <code class="descname">qdma_intr_ring_dump</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned int<em>&nbsp;vector_idx</em>, int<em>&nbsp;start_idx</em>, int<em>&nbsp;end_idx</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_intr_ring_dump" title="Permalink to this definition">¶</a></dt>
<dd><p>display the interrupt ring info of a vector</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">vector_idx</span></code></dt>
<dd>vector number</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">start_idx</span></code></dt>
<dd>interrupt ring start idx</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">end_idx</span></code></dt>
<dd>interrupt ring end idx</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message bufferuffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success or &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_descq_get_cmpt_udd">
int <code class="descname">qdma_descq_get_cmpt_udd</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, unsigned long<em>&nbsp;qhndl</em>, char *<em>&nbsp;buf</em>, int<em>&nbsp;buflen</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_descq_get_cmpt_udd" title="Permalink to this definition">¶</a></dt>
<dd><p>function to receive the user defined data</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">qhndl</span></code></dt>
<dd>queue handle</dd>
<dt><code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">*</span> <span class="pre">buf</span></code></dt>
<dd>message bufferuffer</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">buflen</span></code></dt>
<dd>length of the input buffer</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success or &lt;0 for error</p>
<dl class="function">
<dt id="c.qdma_vf_qconf">
int <code class="descname">qdma_vf_qconf</code><span class="sig-paren">(</span>unsigned long<em>&nbsp;dev_hndl</em>, int<em>&nbsp;qmax</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qdma_vf_qconf" title="Permalink to this definition">¶</a></dt>
<dd><p>call for VF to request qmax number of Qs</p>
</dd></dl>

<p><strong>Parameters</strong></p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">dev_hndl</span></code></dt>
<dd>dev_hndl returned from <a class="reference internal" href="#c.qdma_device_open" title="qdma_device_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">qdma_device_open()</span></code></a></dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">qmax</span></code></dt>
<dd>number of qs requested by vf</dd>
</dl>
<p><strong>Return</strong></p>
<p>0 for success or &lt;0 for error</p>
</div>


           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="qdma_design.html" class="btn btn-neutral float-right" title="QDMA Linux Driver Design Flow" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="devguide.html" class="btn btn-neutral" title="Developers Guide" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2018-2019, Xilinx, Inc.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'2018.3',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>